% Data for Case Study 6: Least-Squares Solutions

disp('Type 7 for example 1, type 8 for example 1b,')  
ex = input('type 9 for example 2, type 1,2 or 3 for questions 1,2, or 3: ');
       
if ex==7
   X=[ 1, 0; 1, 4; 1, 8; 1, 12; 1, 16; 1, 20; 1, 24; 1, 28; 1, 32; 1,36]
   y=[44.66; 44.26; 44.60; 44.27; 43.87; 43.50; 43.49; 43.84, 44.01; 43.75]
   
elseif ex==8
   X=[ 1, 0, 0; 1, 4, 16; 1, 8, 64; 1, 12, 144; 1, 16, 256; 1, 20, 400; 1, 24, 576;...
      1, 28, 784; 1, 32, 1024; 1, 36, 1296 ] 
	y=[44.66; 44.26; 44.60; 44.27; 43.87; 43.50; 43.49; 43.84; 44.01; 43.75]

elseif ex==9
   X=[1, 1, 0;  1, cos(118*pi/365), sin(118*pi/365); ...
				1, cos(240*pi/365), sin(240*pi/365);...
   			1, cos(362*pi/365), sin(362*pi/365);...
				1, cos(486*pi/365), sin(486*pi/365); ...
   	   1, cos(608*pi/365), sin(608*pi/365)] 
	high = [50; 61; 79; 88; 82; 62]
	low =[31; 39; 57; 69; 63; 40]

elseif ex==1
   X1 = [1 1; 1 2; 1 3; 1 4; 1 5], y=[2; 3; 5; 4; 1]
   X2 = [1 1 1; 1 2 4; 1 3 9; 1 4 16; 1 5 25]
elseif ex==2
   y=[44.66; 44.26; 44.60; 44.27; 43.87; 43.50; 43.49; 43.84]
   beta1 = [1 1/10; 1 1/14; 1 1/18; 1 1/22; 1 1/26; 1 1/30; 1 1/34; 1 1/38] 
   beta2 = [1 log(10); 1 log(14); 1 log(18); 1 log(22); 1 log(26); ...
         1 log(30); 1 log(34); 1 log(38)]
elseif ex==3
   time = [1 3 5 7 9 11]
   level = [-1.60 0.47 2.25  2.47  1.08  -1.21]
else
   disp('No data for this exercise in Case Study 6.') 
end



